﻿<phone:PhoneApplicationPage x:Class="WPNEXT.Views.StylePage"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            d:DesignHeight="768"
                            d:DesignWidth="480"
                            FontFamily="{StaticResource PhoneFontFamilyNormal}"
                            FontSize="{StaticResource PhoneFontSizeNormal}"
                            Foreground="{StaticResource PhoneForegroundBrush}"
                            Orientation="Portrait"
                            shell:SystemTray.IsVisible="True"
                            SupportedOrientations="Portrait"
                            mc:Ignorable="d">
    <phone:PhoneApplicationPage.Resources>
        <ControlTemplate x:Key="PhoneScrollbarThumb" TargetType="Thumb">
            <Rectangle Width="{TemplateBinding Width}"
                       Height="{TemplateBinding Height}"
                       Fill="{TemplateBinding Background}"
                       IsHitTestVisible="False" />
        </ControlTemplate>
        <Style x:Key="ScrollBarStyle1" TargetType="ScrollBar">
            <Setter Property="Background" Value="{StaticResource PhoneDisabledBrush}" />
            <Setter Property="Padding" Value="1" />
            <Setter Property="IsTabStop" Value="False" />
            <Setter Property="MinWidth" Value="5" />
            <Setter Property="MinHeight" Value="5" />
            <Setter Property="IsHitTestVisible" Value="False" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ScrollBar">
                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Disabled" />
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Grid x:Name="VerticalRoot"
                                  Width="{TemplateBinding Width}"
                                  Background="Transparent">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <RepeatButton x:Name="VerticalSmallDecrease" Visibility="Collapsed" />
                                <RepeatButton x:Name="VerticalLargeDecrease"
                                              Grid.Row="1"
                                              Width="0"
                                              Template="{x:Null}" />
                                <Thumb x:Name="VerticalThumb"
                                       Grid.Row="2"
                                       Width="{TemplateBinding Width}"
                                       MinHeight="72"
                                       Margin="{TemplateBinding Padding}"
                                       Background="{TemplateBinding Background}"
                                       Template="{StaticResource PhoneScrollbarThumb}" />
                                <RepeatButton x:Name="VerticalLargeIncrease"
                                              Grid.Row="3"
                                              Width="0"
                                              Template="{x:Null}" />
                                <RepeatButton x:Name="VerticalSmallIncrease" Visibility="Collapsed" />
                            </Grid>
                            <Grid x:Name="HorizontalRoot"
                                  Height="{TemplateBinding Height}"
                                  Background="Transparent">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <RepeatButton x:Name="HorizontalSmallDecrease" Visibility="Collapsed" />
                                <RepeatButton x:Name="HorizontalLargeDecrease"
                                              Grid.Column="1"
                                              Height="0"
                                              Template="{x:Null}" />
                                <Thumb x:Name="HorizontalThumb"
                                       Grid.Column="2"
                                       Height="{TemplateBinding Height}"
                                       MinWidth="72"
                                       Margin="{TemplateBinding Padding}"
                                       Background="{TemplateBinding Background}"
                                       Template="{StaticResource PhoneScrollbarThumb}" />
                                <RepeatButton x:Name="HorizontalLargeIncrease"
                                              Grid.Column="3"
                                              Height="0"
                                              Template="{x:Null}" />
                                <RepeatButton x:Name="HorizontalSmallIncrease" Visibility="Collapsed" />
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ScrollViewerStyle1" TargetType="ScrollViewer">
            <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
            <Setter Property="HorizontalScrollBarVisibility" Value="Disabled" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="Padding" Value="0" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="BorderBrush" Value="Transparent" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ScrollViewer">
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="ScrollStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="00:00:00.5" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Scrolling">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0"
                                                             Storyboard.TargetName="VerticalScrollBar"
                                                             Storyboard.TargetProperty="Opacity"
                                                             To="1" />
                                            <DoubleAnimation Duration="0"
                                                             Storyboard.TargetName="HorizontalScrollBar"
                                                             Storyboard.TargetProperty="Opacity"
                                                             To="1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="NotScrolling" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Grid Margin="{TemplateBinding Padding}">
                                <ScrollContentPresenter x:Name="ScrollContentPresenter"
                                                        Content="{TemplateBinding Content}"
                                                        ContentTemplate="{TemplateBinding ContentTemplate}" />
                                <ScrollBar x:Name="VerticalScrollBar"
                                           Width="5"
                                           Height="Auto"
                                           HorizontalAlignment="Right"
                                           VerticalAlignment="Stretch"
                                           IsHitTestVisible="False"
                                           IsTabStop="False"
                                           Maximum="{TemplateBinding ScrollableHeight}"
                                           Minimum="0"
                                           Opacity="0"
                                           Orientation="Vertical"
                                           Style="{StaticResource ScrollBarStyle1}"
                                           ViewportSize="{TemplateBinding ViewportHeight}"
                                           Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                           Value="{TemplateBinding VerticalOffset}" />
                                <ScrollBar x:Name="HorizontalScrollBar"
                                           Width="Auto"
                                           Height="5"
                                           HorizontalAlignment="Stretch"
                                           VerticalAlignment="Bottom"
                                           IsHitTestVisible="False"
                                           IsTabStop="False"
                                           Maximum="{TemplateBinding ScrollableWidth}"
                                           Minimum="0"
                                           Opacity="0"
                                           Orientation="Horizontal"
                                           ViewportSize="{TemplateBinding ViewportWidth}"
                                           Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                           Value="{TemplateBinding HorizontalOffset}" />
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <DataTemplate x:Key="DataTemplate1">
            <Grid />
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>

    <!--  LayoutRoot is the root grid where all page content is placed  -->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!--  TitlePanel contains the name of the application and page title  -->
        <StackPanel x:Name="TitlePanel"
                    Grid.Row="0"
                    Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle"
                       Style="{StaticResource PhoneTextNormalStyle}"
                       Text="MY APPLICATION" />
            <TextBlock x:Name="PageTitle"
                       Margin="9,-7,0,0"
                       Style="{StaticResource PhoneTextTitle1Style}"
                       Text="page name" />
        </StackPanel>

        <!--  ContentPanel - place additional content here  -->
        <Grid x:Name="ContentPanel"
              Grid.Row="1"
              Margin="12,0,12,0">
            <ScrollViewer ContentTemplate="{StaticResource DataTemplate1}" Style="{StaticResource ScrollViewerStyle1}" />
        </Grid>
    </Grid>

    <!--  Sample code showing usage of ApplicationBar  -->
    <!--
        <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
        <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
        <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
        <shell:ApplicationBar.MenuItems>
        <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
        <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
        </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
        </phone:PhoneApplicationPage.ApplicationBar>
    -->

</phone:PhoneApplicationPage>
